#ifndef _OSA_MSGBOX_H_
#define _OSA_MSGBOX_H_
#include <osa_common.h>
#include <osa_sem.h>

typedef struct osa_msgbox_body_t
{
    void** Entries;
    void** BoxIn;
    void** BoxOut;
    void** BoxEnd;
    osa_sem_t sem;
    uint16_t BoxCount; /* Current count of entries in msg box */
    uint16_t BoxSize; /* Size of queue (maximum number of entries)                   */
} osa_msgbox_body_t;
typedef osa_msgbox_body_t *osa_msgbox_t;

osa_result_t osa_msgbox_create(osa_msgbox_t box, void**buf, uint16_t sz);
osa_result_t osa_msgbox_fetch(osa_msgbox_t box, void** msg, uint32_t timeout);
osa_result_t osa_msgbox_tryfetch(osa_msgbox_t box, void** msg);
osa_result_t osa_msgbox_post(osa_msgbox_t box, void* msg, uint32_t timeout);
osa_result_t osa_msgbox_trypost(osa_msgbox_t box, void* msg);
osa_result_t osa_msgbox_delete(osa_msgbox_t box);

#endif /* _OSA_MSGBOX_H_ */